﻿using System;
using NUnit.Framework;
using PhantomChainsAnalyser.Model;

namespace TestPhantomChainsAnalyser
{
    [TestFixture]
    public class TestIntervalDivider
    {
        [Test]
        public void TestVolume()
        {
            IntervalDivider Divider = new IntervalDivider();
            Sampling sample = new Sampling();
            sample.AddValue(1);
            sample.AddValue(2);
            sample.AddValue(4);
            sample.AddValue(-10);
            Divider.Divide(sample);
            Assert.AreEqual(20,Divider.Values.Count);
            Assert.AreEqual(21,Divider.Borders.Count);
        }

        [Test]
        public void TestContent()
        {
            IntervalDivider Divider = new IntervalDivider();
            Sampling sample = new Sampling();
            sample.AddValue(-0.326);
            for (int i = 0; i < 9999; i++)
            {
                sample.AddValue(sample[i]+Math.Sqrt(0.54700002));
            }
            Divider.Divide(sample);
            int sum = 0;
            for(int j=0;j<Divider.Values.Count;j++)
            {
                sum += Divider.Values[j];
            }
            Assert.AreEqual(10000,sum);
        }
    }
}
